import React, { useState } from 'react'
import { BsHouseDoorFill, BsHouseDoor, BsBagFill, BsBag, BsPersonFill, BsPerson } from "react-icons/bs"
import { NavBar, TabBar } from 'antd-mobile-v5'
import Proptypes from "prop-types"
import { history } from 'umi'
import "./index.less"
export default function index(props: any) {
    let [nav, setNav] = useState([
        {
            link: '/',
            title: "首页",
            selectedIcon: <BsHouseDoorFill />,
            icon: <BsHouseDoor />,

        },
        {
            link: '/order',
            title: "订单",
            selectedIcon: <BsBagFill />,
            icon: <BsBag />,
        },
        {
            link: '/user',
            title: "我的",
            selectedIcon: <BsPersonFill />,
            icon: <BsPerson />,
        },
    ])

    let { show, pathname } = props

    return (
        < div>
            <TabBar className='tab' onChange={(val) => history.push(val)}>
                {nav.map(item => (
                    <TabBar.Item
                        key={item.link}
                        icon={item.icon}
                        title={item.title}
                    />
                ))}
            </TabBar>
        </ div>
    )
}

index.defaultProps = {
    show: false,
    pathname: ""
}

index.propTypes = {
    show: Proptypes.bool,
    pathname: Proptypes.string
}